//
// Created by yorkc on 2023/12/21.
//

#ifndef BASE_MYFRIENDS_H
#define BASE_MYFRIENDS_H
#include <nlohmann/json.hpp>
using namespace nlohmann;
using namespace std;
class myfriends {
public:
    myfriends();

    /**
     * 讲数据库数据转化为对象
     * @param results
     * @return 单个结果
     */
    myfriends * db_to_obj(vector<map<std::string, std::string>> &results);


    /**
     * 讲数据库数据转化为对象
     * @param results
     * @return 多个结果
     */
    static vector<myfriends> db_to_objs(vector<map<std::string, std::string>> &results);

    static vector<myfriends *> db_to_objsp(vector<map<std::string, std::string>> &results);

    void json_to_obj(const nlohmann::json &json, myfriends &obj);

    void obj_to_json(nlohmann::json &json, const myfriends &obj);

    int getId() const;

    void setId(int id);

    int getAge() const;

    void setAge(int age);

    const string &getName() const;

    void setName(const string &name);

    const string &getMajor() const;

    void setMajor(const string &major);

private:
    int ID;
    int Age;
    string Name;
    string Major;
};


#endif //BASE_MYFRIENDS_H
